| Conditions | 5 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | import InvalidInputError from './InvalidInputError'; |
||
| 21 | static totalTrueInputs(row) { |
||
| 22 | 133 | if (!Array.isArray(row)) { |
|
| 23 | 4 | throw new InvalidInputError(row, 'row isnt an array'); |
|
| 24 | } |
||
| 25 | |||
| 26 | 129 | if (row.length < 1) { |
|
| 27 | 1 | return 0; |
|
| 28 | } |
||
| 29 | |||
| 30 | 128 | return row.reduce( |
|
| 31 | 288 | (accumulator, currentValue) => accumulator + (currentValue ? 1 : 0) |
|
| 32 | ); |
||
| 33 | } |
||
| 34 | } |
||
| 35 |